// import 路由设置
import router, { resetRouter as _resetRouter, createRoutesInLayout } from './base'

// import 路由
import routes from './router'

// export
export function resetRouter (extendRoutes) {
  let allRoutes
  if (extendRoutes && extendRoutes.length) {
    allRoutes = [ ...routes, ...extendRoutes ]
  } else {
    allRoutes = [ ...routes ]
  }
  _resetRouter(createRoutesInLayout(allRoutes))
}

resetRouter()

export const constantRoutes = routes
export default router
